import {createStore} from "vuex";
export default createStore({
    //集中存储组件的状态
    state:{
        load:false,
        sys_announcement:"系统公告",
        httpImg:"http://47.98.224.49:8941",
        request_info:[],
        time:"",
    },
    //改数据方法的集合
    mutations:{
        //控制遮罩层
        LoadTheAnimation(state){
            state.load = !state.load;
        },
        sys_announcement(state,item){
            state.sys_announcement = item;
        },
        delRequestInfoAll(state){
            state.request_info.length=0;
        },
        requestInfo(state,item){
            if( state.time){
                clearInterval(state.time);
            }
            state.request_info.unshift(item);
            state.time  = setInterval(()=>{
                if(state.request_info.length<=0){
                  clearInterval(state.time);
              }
              state.request_info.pop()
          },1200)
        }
    },
    //改变mutations,不直接改状态
    actions:{


    },
    //可以将store功能进行拆分  分出不同模块
    modules:{

    },
})